global path "****"

set more off
clear all
mat drop _all
estimates clear

local date = "060220"

set obs 24
gen month = _n


local arm early nonpersonalize exemption_info base early_sp nonpersonalize_sp exemption_info_sp base_sp ///
			early_no_sp nonpersonalize_no_sp exemption_info_no_sp base_no_sp

			
*extra months
foreach i in `arm'{
forval c = 1/24 {
	estimates use "$path/Results/Estimates/`i'_months_060220.ster", number(`c')
	eststo c`c'
	est restore c`c'
	mat `i'_weights = nullmat(`i'_weights) \ (_b[treatment])
}
svmat `i'_weights
rename `i'_weights1 `i'_weights
qui sum `i'_weights 
replace `i'_weights = (`i'_weights/ r(sum))
}


export excel using "$path/ACR calculations/weights_raw_`date'.xlsx", firstrow(variables) replace

clear all
mat drop _all

forval i = 1/12{
estimates use "$path/Results/Estimates/acr_by_arm_060220.ster", number(`i')
mat acr = nullmat(acr) \ _b[covered1718]*100
}

svmat acr
